package com.winit.flow.repository;

import com.winit.flow.model.FlowFeatureRelation;
import com.winit.flow.model.FlowFeatureRelationId;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import javax.transaction.Transactional;
import java.util.List;

public interface FlowFeatureRelationRepository extends CrudRepository<FlowFeatureRelation, FlowFeatureRelationId>{
    @Transactional
    @Modifying
//    @Query(value = "delete from matrix_flow_legend_relation where  flow_id = ?1", nativeQuery = true)
    int deleteByFlowIdAndReqId(String flowId, String reqId);

    List<FlowFeatureRelation> findByFlowIdAndReqId(String flowId, String reqId);

    List<FlowFeatureRelation> findByFeatureIdAndReqId(String featureId, String reqId);

    int countByFeatureIdAndReqId(String featureId, String reqId);

}
